/** recommend中的action */
import { getNewMusic, getRemdSongList } from "../../../api/summary";
import { RECEIVE_NEW_MUSIC, RECEIVE_SONGLIST } from "./types";

const receiveNewMusicAction = data => ({ type: RECEIVE_NEW_MUSIC, data });
const receiveSongListAction = data => ({ type: RECEIVE_SONGLIST, data });

export function getNewMusicAction() {
  return async dispatch => {
    const result = await getNewMusic();
    if (result.code === 200) {
      dispatch(receiveNewMusicAction(result.result));
    }
  };
}
export function getRemdSongListAction() {
  return async dispatch => {
    const result = await getRemdSongList();
    if (result.code === 200) {
      dispatch(receiveSongListAction(result.result));
    }
  };
}
